
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">        
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta name="description" content="">
        <meta name="author" content="">
        <?php include 'commonInclude.php'; ?>
    </head>                
    <body onload=" loadContent('homeMenu')" >


        <!-- Part 1: Wrap all page content here -->
        <div id="wrap">

            <!-- Fixed navbar -->
            <?php include 'menu.php'; ?>            
            <!-- Begin page content -->
            <div class="container">
                <?php
//                $u = new Users();
//                $users = $u->getUsers("admin");
//                $json = json_encode($users);
//                print_r($json);
//                
                ?>
                <div id="myContents">

                </div>
            </div>
        </div>
        <script>            
            var fullJson;
            function fillTable(json){
                fullJson = json;
                //                console.log(json);
                //                console.log(json.total);
                //                console.log(json.user[1]);
                $(".well .table tbody").empty();
                for(var i=1;i<json.total;i++){
                    var role = json.user[i].role;
                    role = (role=="") ? json.user[i].type : role;
                    $content = '<tr><td>'+i+'</td>'+
                        '<td>'+json.user[i].fname+'</td>'+
                        '<td>'+json.user[i].lname+'</td>'+
                        '<td>'+json.user[i].email+'</td>'+
                        '<td>'+role+'</td>'+
                        '<td><a href="#updateUser" data-id="'+i+'" class="updateUser" role="button" data-toggle="modal"><i class="icon-pencil"></i></a>'+
                        '<a href="#myModal" data-id="'+json.user[i].id+'" class="removeUser" role="button" data-toggle="modal"><i class="icon-remove"></i></a></td></tr>';  
                    $(".well .table tbody").append($content);
                }
                                
            }
            function activeMenubar(id){
                $("#"+id).addClass("active");
            }
        
            function getActiveMenu(id){
                $.each($(".nav li"),function(){
                    var a = $(this.id).attr('class','active').selector;                
                    if(a!=id){                    
                        $("#"+a).removeClass("active");                    
                    }
                });
            }
        
            function getExactFilePath(cv){            
                var path;
                switch(cv){
                    case 'homeMenu':                    
                        getActiveMenu(cv);
                        activeMenubar(cv);
                        path = 'basehome.php';
                        break;
                    case 'aboutMenu':                    
                        getActiveMenu(cv);
                        activeMenubar(cv);
                        path = 'about.php';
                        break;
                    case 'membersMenu':                    
                        getActiveMenu(cv);
                        activeMenubar(cv);
                        path = 'members.php';
                        break;
                    case 'employeeMenu':
                        getActiveMenu(cv);
                        activeMenubar(cv);
                        path = 'employee.php';
                        break;
                }
                return path;
            }
        
        
            function loadContent(cv){
                var url = getExactFilePath(cv);            
                $.post(url,function(data){                
                    $("#myContents").html(data).show();
                });
            }
            
            function setCongifValues(){}
            
        </script>
        <?php include 'footer.php'; ?>

    </body>



</html>
